package com.ruoyi.system.service.impl;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.entity.PreventionRiskOughtFile;
import com.ruoyi.system.entity.SafetyRulesRegulationsFile;
import com.ruoyi.system.mapper.PreventionRiskOughtFileMapper;
import com.ruoyi.system.mapper.SafetyRulesRegulationsFileMapper;
import com.ruoyi.system.service.SafetyRulesRegulationsFileService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 风险应知卡附件表 服务实现类
 * </p>
 * @since 2023-03-10
 */
@Service("safetyRulesRegulationsFileService")
public class SafetyRulesRegulationsFileServiceImpl implements SafetyRulesRegulationsFileService {

    @Resource
    private SafetyRulesRegulationsFileMapper safetyRulesRegulationsFileMapper;

    @Override
    public List<SafetyRulesRegulationsFile> queryByPage(SafetyRulesRegulationsFile safetyRulesRegulationsFile) {
        return safetyRulesRegulationsFileMapper.queryAllByLimit(safetyRulesRegulationsFile);
    }

    @Override
    public SafetyRulesRegulationsFile queryById(Integer id) {
        return this.safetyRulesRegulationsFileMapper.queryById(id);
    }

    @Override
    public SafetyRulesRegulationsFile insert(SafetyRulesRegulationsFile safetyRulesRegulationsFile) {
        //safetyRulesRegulationsFile.setCreateUser(SecurityUtils.getUsername());
        this.safetyRulesRegulationsFileMapper.insert(safetyRulesRegulationsFile);
        return safetyRulesRegulationsFile;
    }

    @Override
    public SafetyRulesRegulationsFile update(SafetyRulesRegulationsFile safetyRulesRegulationsFile) {
        this.safetyRulesRegulationsFileMapper.update(safetyRulesRegulationsFile);
        return this.queryById(safetyRulesRegulationsFile.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return this.safetyRulesRegulationsFileMapper.deleteById(id) > 0;
    }
}
